package com.wj.opratorlog.utils;

import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class CacheUtils {
    private Map<String, Object> cacheMap = new ConcurrentHashMap<String, Object>();
    Deque<String> deque = new java.util.concurrent.LinkedBlockingDeque<String>();

    public boolean save(String key, String value) {

        if (cacheMap.get(key) != null) {
            Lock lock =new ReentrantLock();

            try
                {
                    cacheMap.put(key, value);
            }
            catch (Exception e){
                lock.unlock();
            }
            finally {
                lock.unlock();
            }

        }
        return true;
    }


}
